package com.sunronsoft.mind.map.model;

import com.jfinal.kit.HashKit;
import com.jfinal.kit.JsonKit;

import java.io.Serializable;

/**
 * @author Sunron
 **/
public class User implements Serializable {

    private static final long serialVersionUID = -8897559173147519184L;
    
    private String userName;
    private String password;
    private String token;
    
    public User() {}
    
    public User(String userName, String password) {
        this(userName, password, true);
    }
    
    public User(String userName, String password, boolean isEncrypt) {
        if (!isEncrypt) password = HashKit.md5(password);
        
        this.userName = userName;
        this.password = password;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    @Override
    public String toString() {
        return JsonKit.toJson(this);
    }
}
